﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ComponentModel;
using System.Text;
using Global.Class.Library;

namespace DataTransferObject.MetaDataList
{
    public class QuotaDetail : NotifyPropertyChangeObject
    {
       
        private int customerCategoryID;
        private int customerTypeID;
        private int collectedTypeID;
        private int commodityID;
        private int customerChannelID;

        private double quantityQuota12;
        private double quantityQuota11;
        private double quantityQuota10;
        private double quantityQuota09;
        private double quantityQuota08;
        private double quantityQuota07;
        private double quantityQuota06;
        private double quantityQuota05;
        private double quantityQuota04;
        private double quantityQuota03;
        private double quantityQuota02;
        private double quantityQuota01;
        private double amountQuota12;
        private double amountQuota11;
        private double amountQuota10;
        private double amountQuota09;
        private double amountQuota08;
        private double amountQuota07;
        private double amountQuota06;
        private double amountQuota05;
        private double amountQuota04;
        private double amountQuota03;
        private double amountQuota02;
        private double amountQuota01;

        private string itemCategoryName;
        private string itemCommodityName;
        private string brandName;
        private string unit;

        private bool isCommodity;


        public QuotaDetail()
            : this(-1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,"", "", "", "",false)
        {
        }

        public QuotaDetail(int customerCategoryID, int customerTypeID, int collectedTypeID, int commodityID, int customerChannelID, double quantityQuota12, double quantityQuota11, double quantityQuota10, double quantityQuota09, double quantityQuota08, double quantityQuota07, double quantityQuota06, double quantityQuota05, double quantityQuota04, double quantityQuota03, double quantityQuota02, double quantityQuota01,
                double amountQuota12, double amountQuota11, double amountQuota10, double amountQuota09, double amountQuota08, double amountQuota07, double amountQuota06, double amountQuota05, double amountQuota04, double amountQuota03, double amountQuota02, double amountQuota01, string itemCategoryName, string itemCommodityName, string brandName, string unit, bool isCommodity)
        {
            GlobalDefaultValue.Apply(this);

            this.CustomerCategoryID = customerCategoryID;
            this.CustomerTypeID = customerTypeID;
            this.CollectedTypeID = collectedTypeID;
            this.CommodityID = commodityID;
            this.CustomerChannelID = customerChannelID;
            this.QuantityQuota12 = quantityQuota12;
            this.QuantityQuota11 = quantityQuota11;
            this.QuantityQuota10 = quantityQuota10;
            this.QuantityQuota09 = quantityQuota09;
            this.QuantityQuota08 = quantityQuota08;
            this.QuantityQuota07 = quantityQuota07;
            this.QuantityQuota06 = quantityQuota06;
            this.QuantityQuota05 = quantityQuota05;
            this.QuantityQuota04 = quantityQuota04;
            this.QuantityQuota03 = quantityQuota03;
            this.QuantityQuota02 = quantityQuota02;
            this.QuantityQuota01 = quantityQuota01;
            this.AmountQuota12 = amountQuota12;
            this.AmountQuota11 = amountQuota11;
            this.AmountQuota10 = amountQuota10;
            this.AmountQuota09 = amountQuota09;
            this.AmountQuota08 = amountQuota08;
            this.AmountQuota07 = amountQuota07;
            this.AmountQuota06 = amountQuota06;
            this.AmountQuota05 = amountQuota05;
            this.AmountQuota04 = amountQuota04;
            this.AmountQuota03 = amountQuota03;
            this.AmountQuota02 = amountQuota02;
            this.AmountQuota01 = amountQuota01;

            this.ItemCategoryName = itemCategoryName;
            this.ItemCommodityName = itemCommodityName;
            this.BrandName = brandName;
            this.Unit = unit;
            this.IsCommodity = isCommodity;
        }


        #region Properties      

        [DefaultValue(-1)]
        public int CustomerCategoryID
        {
            get { return this.customerCategoryID; }
            set { ApplyPropertyChange<QuotaDetail, int>(ref this.customerCategoryID, o => o.CustomerCategoryID, value); }
        }

        [DefaultValue(-1)]
        public int CustomerTypeID
        {
            get { return this.customerTypeID; }
            set { ApplyPropertyChange<QuotaDetail, int>(ref this.customerTypeID, o => o.CustomerTypeID, value); }
        }

        [DefaultValue(-1)]
        public int CollectedTypeID
        {
            get { return this.collectedTypeID; }
            set { ApplyPropertyChange<QuotaDetail, int>(ref this.collectedTypeID, o => o.CollectedTypeID, value); }
        }

        [DefaultValue(-1)]
        public int CommodityID
        {
            get { return this.commodityID; }
            set { ApplyPropertyChange<QuotaDetail, int>(ref this.commodityID, o => o.CommodityID, value); }
        }

        [DefaultValue(-1)]
        public int CustomerChannelID
        {
            get { return this.customerChannelID; }
            set { ApplyPropertyChange<QuotaDetail, int>(ref this.customerChannelID, o => o.CustomerChannelID, value); }
        }

        [DefaultValue(0)]
        public double QuantityQuota12
        {
            get { return this.quantityQuota12; }
            set { ApplyPropertyChange<QuotaDetail, double>(ref this.quantityQuota12, o => o.QuantityQuota12, value); }
        }

        [DefaultValue(0)]
        public double QuantityQuota11
        {
            get { return this.quantityQuota11; }
            set { ApplyPropertyChange<QuotaDetail, double>(ref this.quantityQuota11, o => o.QuantityQuota11, value); }
        }

        [DefaultValue(0)]
        public double QuantityQuota10
        {
            get { return this.quantityQuota10; }
            set { ApplyPropertyChange<QuotaDetail, double>(ref this.quantityQuota10, o => o.QuantityQuota10, value); }
        }

        [DefaultValue(0)]
        public double QuantityQuota09
        {
            get { return this.quantityQuota09; }
            set { ApplyPropertyChange<QuotaDetail, double>(ref this.quantityQuota09, o => o.QuantityQuota09, value); }
        }

        [DefaultValue(0)]
        public double QuantityQuota08
        {
            get { return this.quantityQuota08; }
            set { ApplyPropertyChange<QuotaDetail, double>(ref this.quantityQuota08, o => o.QuantityQuota08, value); }
        }

        [DefaultValue(0)]
        public double QuantityQuota07
        {
            get { return this.quantityQuota07; }
            set { ApplyPropertyChange<QuotaDetail, double>(ref this.quantityQuota07, o => o.QuantityQuota07, value); }
        }

        [DefaultValue(0)]
        public double QuantityQuota06
        {
            get { return this.quantityQuota06; }
            set { ApplyPropertyChange<QuotaDetail, double>(ref this.quantityQuota06, o => o.QuantityQuota06, value); }
        }

        [DefaultValue(0)]
        public double QuantityQuota05
        {
            get { return this.quantityQuota05; }
            set { ApplyPropertyChange<QuotaDetail, double>(ref this.quantityQuota05, o => o.QuantityQuota05, value); }
        }

        [DefaultValue(0)]
        public double QuantityQuota04
        {
            get { return this.quantityQuota04; }
            set { ApplyPropertyChange<QuotaDetail, double>(ref this.quantityQuota04, o => o.QuantityQuota04, value); }
        }

        [DefaultValue(0)]
        public double QuantityQuota03
        {
            get { return this.quantityQuota03; }
            set { ApplyPropertyChange<QuotaDetail, double>(ref this.quantityQuota03, o => o.QuantityQuota03, value); }
        }

        [DefaultValue(0)]
        public double QuantityQuota02
        {
            get { return this.quantityQuota02; }
            set { ApplyPropertyChange<QuotaDetail, double>(ref this.quantityQuota02, o => o.QuantityQuota02, value); }
        }

        [DefaultValue(0)]
        public double QuantityQuota01
        {
            get { return this.quantityQuota01; }
            set { ApplyPropertyChange<QuotaDetail, double>(ref this.quantityQuota01, o => o.QuantityQuota01, value); }
        }

        [DefaultValue(0)]
        public double AmountQuota12
        {
            get { return this.amountQuota12; }
            set { ApplyPropertyChange<QuotaDetail, double>(ref this.amountQuota12, o => o.AmountQuota12, value); }
        }

        [DefaultValue(0)]
        public double AmountQuota11
        {
            get { return this.amountQuota11; }
            set { ApplyPropertyChange<QuotaDetail, double>(ref this.amountQuota11, o => o.AmountQuota11, value); }
        }

        [DefaultValue(0)]
        public double AmountQuota10
        {
            get { return this.amountQuota10; }
            set { ApplyPropertyChange<QuotaDetail, double>(ref this.amountQuota10, o => o.AmountQuota10, value); }
        }

        [DefaultValue(0)]
        public double AmountQuota09
        {
            get { return this.amountQuota09; }
            set { ApplyPropertyChange<QuotaDetail, double>(ref this.amountQuota09, o => o.AmountQuota09, value); }
        }

        [DefaultValue(0)]
        public double AmountQuota08
        {
            get { return this.amountQuota08; }
            set { ApplyPropertyChange<QuotaDetail, double>(ref this.amountQuota08, o => o.AmountQuota08, value); }
        }

        [DefaultValue(0)]
        public double AmountQuota07
        {
            get { return this.amountQuota07; }
            set { ApplyPropertyChange<QuotaDetail, double>(ref this.amountQuota07, o => o.AmountQuota07, value); }
        }

        [DefaultValue(0)]
        public double AmountQuota06
        {
            get { return this.amountQuota06; }
            set { ApplyPropertyChange<QuotaDetail, double>(ref this.amountQuota06, o => o.AmountQuota06, value); }
        }

        [DefaultValue(0)]
        public double AmountQuota05
        {
            get { return this.amountQuota05; }
            set { ApplyPropertyChange<QuotaDetail, double>(ref this.amountQuota05, o => o.AmountQuota05, value); }
        }

        [DefaultValue(0)]
        public double AmountQuota04
        {
            get { return this.amountQuota04; }
            set { ApplyPropertyChange<QuotaDetail, double>(ref this.amountQuota04, o => o.AmountQuota04, value); }
        }

        [DefaultValue(0)]
        public double AmountQuota03
        {
            get { return this.amountQuota03; }
            set { ApplyPropertyChange<QuotaDetail, double>(ref this.amountQuota03, o => o.AmountQuota03, value); }
        }

        [DefaultValue(0)]
        public double AmountQuota02
        {
            get { return this.amountQuota02; }
            set { ApplyPropertyChange<QuotaDetail, double>(ref this.amountQuota02, o => o.AmountQuota02, value); }
        }

        [DefaultValue(0)]
        public double AmountQuota01
        {
            get { return this.amountQuota01; }
            set { ApplyPropertyChange<QuotaDetail, double>(ref this.amountQuota01, o => o.AmountQuota01, value); }
        }

        [DefaultValue("")]
        public string ItemCategoryName
        {
            get { return this.itemCategoryName; }
            set { ApplyPropertyChange<QuotaDetail, string>(ref this.itemCategoryName, o => o.ItemCategoryName, value); }
        }

        [DefaultValue("")]
        public string ItemCommodityName
        {
            get { return this.itemCommodityName; }
            set { ApplyPropertyChange<QuotaDetail, string>(ref this.itemCommodityName, o => o.ItemCommodityName, value); }
        }


        [DefaultValue("")]
        public string BrandName
        {
            get { return this.brandName; }
            set { ApplyPropertyChange<QuotaDetail, string>(ref this.brandName, o => o.BrandName, value); }
        }

        [DefaultValue("")]
        public string Unit
        {
            get { return this.unit; }
            set { ApplyPropertyChange<QuotaDetail, string>(ref this.unit, o => o.Unit, value); }
        }

        [DefaultValue(false)]
        public bool IsCommodity
        {
            get { return this.isCommodity; }
            set { ApplyPropertyChange<QuotaDetail, bool>(ref this.isCommodity, o => o.IsCommodity, value); }
        }

        #endregion

        protected override System.Collections.Generic.List<ValidationRule> CreateRules()
        {
            List<ValidationRule> validationRules = base.CreateRules();
            //validationRules.Add(new SimpleValidationRule("CommodityID", "Please fill a CommodityID ID.", delegate { return (this.CommodityID > 0); }));          

            return validationRules;
        }
    }
}
